# 此脚本有问题，请勿使用
# NuGet API 密钥
$apiKey = "oy2o4pejok2dwpvnjghal6dvbfcoehhuldxezcmww6shpy"

# NuGet 源
$nugetSource = "https://api.nuget.org/v3/index.json"

# 输出信息
echo "Starting NuGet package deletion process..."

# 获取包列表
$packages = dotnet nuget list -AllVersions -Source $nugetSource -ApiKey $apiKey

# 遍历包列表并删除包
foreach ($package in $packages) {
    # 提取包的 ID 和 版本
    $packageInfo = $package -split '\s+'
    $packageId = $packageInfo[0]
    $packageVersion = $packageInfo[1]
    
    # 输出删除信息
    echo "Deleting package: $packageId $packageVersion"
    
    # 删除包
    dotnet nuget delete $packageId $packageVersion -Source $nugetSource -ApiKey $apiKey -NonInteractive
}

# 输出完成信息
echo "All packages have been deleted."
